package org.jeecg.entity.charge;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.jeecg.enums.common.PayTypeEnum;
import org.jeecg.vo.charge.ChargeBillsJump;
import org.jeecgframework.poi.excel.annotation.Excel;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;
import java.util.List;

/**
 * @Description: 票据详情
 * @Author: jeecg-boot
 * @Date:   2019-08-23
 * @Version: V1.0
 */
@Data
@TableName("charge_invoice_info")
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value="charge_invoice_info对象", description="票据详情")
public class ChargeInvoiceInfo {

	/**id*/
	@TableId(type = IdType.ID_WORKER_STR)
    @ApiModelProperty(value = "id")
	private String id;
	/**发票号码*/
	@Excel(name = "发票号码", width = 15)
    @ApiModelProperty(value = "发票号码")
	private String invoiceHm;
	/**发票代码（入库单编号）*/
	@Excel(name = "发票代码（入库单编号）", width = 15)
    @ApiModelProperty(value = "发票代码（入库单编号）")
	private String invoiceDm;
	/**开票项目*/
	@Excel(name = "开票项目", width = 15)
    @ApiModelProperty(value = "开票项目")
	private String invoiceObject;
	/**数量*/
	@Excel(name = "数量", width = 15)
    @ApiModelProperty(value = "数量")
	private Integer num;
	/**单位*/
	@Excel(name = "单位", width = 15)
    @ApiModelProperty(value = "单位")
	private String unit;
	/**单价*/
	@Excel(name = "单价", width = 15)
    @ApiModelProperty(value = "单价")
	private Double unitPrice;
	/**金额*/
	@Excel(name = "金额", width = 15)
    @ApiModelProperty(value = "金额")
	private Double money;
	/**摘要*/
	@Excel(name = "摘要", width = 15)
    @ApiModelProperty(value = "摘要")
	private String abstractInfo;
	/**科目代号*/
	@Excel(name = "科目代号", width = 15)
    @ApiModelProperty(value = "科目代号")
	private String subjectCode;
	/**票据表ID*/
	@Excel(name = "票据表ID", width = 15)
    @ApiModelProperty(value = "票据表ID")
	private String invoiceId;
	/**收费项目编号*/
	@Excel(name = "收费项目编号", width = 15)
    @ApiModelProperty(value = "收费项目编号")
	private String feeitemId;
	/**非日常,0:日常收费,1:非日常收费*/
	@Excel(name = "非日常,0:日常收费,1:非日常收费", width = 15)
    @ApiModelProperty(value = "非日常,0:日常收费,1:非日常收费")
	private String isDay;
	/**税额*/
	@Excel(name = "税额", width = 15)
    @ApiModelProperty(value = "税额")
	private Double tax;
	/**税率*/
	@Excel(name = "税率", width = 15)
    @ApiModelProperty(value = "税率")
	private Double rate;
	/**不含税单价*/
	@Excel(name = "不含税单价", width = 15)
    @ApiModelProperty(value = "不含税单价")
	private Double realPrice;
	/**不含税金额*/
	@Excel(name = "不含税金额", width = 15)
    @ApiModelProperty(value = "不含税金额")
	private Double realMoney;
	/**创建者*/
	@Excel(name = "创建者", width = 15)
    @ApiModelProperty(value = "创建者")
	private String createBy;
	/**创建日期*/
	@Excel(name = "创建日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
	private Date createDate;
	/**更新者*/
	@Excel(name = "更新者", width = 15)
    @ApiModelProperty(value = "更新者")
	private String updateBy;
	/**更新日期*/
	@Excel(name = "更新日期", width = 20, format = "yyyy-MM-dd HH:mm:ss")
	@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
	private Date updateDate;
	/**删除标记（0：正常；1：删除；2：审核）*/
	@Excel(name = "删除标记（0：正常；1：删除；2：审核）", width = 15)
    @ApiModelProperty(value = "删除标记（0：正常；1：删除；2：审核）")
	private String delFlag;
	/**remarks*/
	@Excel(name = "remarks", width = 15)
    @ApiModelProperty(value = "remarks")
	private String remarks;
	/**tenantId*/
	@Excel(name = "tenantId", width = 15)
    @ApiModelProperty(value = "tenantId")
	private String tenantId;
	/**押金状态，0：未退款 1：已退款 2：退款账单*/
	@Excel(name = "押金状态，0：未退款 1：已退款 2：退款账单", width = 15)
    @ApiModelProperty(value = "押金状态，0：未退款 1：已退款 2：退款账单")
	private String isDeposit;
	/**退款押金关联编号*/
	@Excel(name = "退款押金关联编号", width = 15)
	@ApiModelProperty(value = "退款押金关联编号")
	private String depositId;


	/**
	*  收费方式
	 * */
	@TableField(exist = false)
	private Integer payMethod;

	private String payMethodStr;

	/**
	 * 收款日期
	 * */
	@TableField(exist = false)
	private Date zjSkrq;
	/**
	 * 开票日期
	 * */
	@TableField(exist = false)
	private String makeInvoiceDate;

	/**
	 *  房间名称
	 * */
	@TableField(exist = false)
	private String roomName;
	/**
	 * 付款人
	 * */
	@TableField(exist = false)
	private String crmName;
	/**
	 * 付款人Id
	 * */
	@TableField(exist = false)
	private String customerId;
	/**
	 *  付款人地址
	 * */
	@TableField(exist = false)
	private String address;
	/**
	 * 项目id
	 * */
	@TableField(exist = false)
	private String projectId;
	/**
	 * 楼宇id
	 * */
	@TableField(exist = false)
	private String floorId;
	/**
	 * 开始时间
	 * */
	@TableField(exist = false)
	private String startSkrq;
	/**
	 * 结束时间
	 * */
	@TableField(exist = false)
	private String endSkrq;
	/**
	 * 收费方式集合
	 * */
	@TableField(exist = false)
	private List<String> paymethods;

	/**
	 * 收费项目编号集合
	 * */
	@TableField(exist = false)
	private List<String> feeCodes;

	/**
	 * 租户Id
	 * */
	@TableField(exist = false)
	private String rentId;

	/**
	 * 开始条数
	 * */
	@TableField(exist = false)
	private Integer pageNo;

	@TableField(exist = false)
	private String feeitemCode;

	@TableField(exist = false)
	private String roomId;

	/**
	 * 截止条数
	 * */
	@TableField(exist = false)
	private Integer pageSize;

	/**
	 *票据详情集合;
	 * */
	@TableField(exist = false)
	private List<ChargeInvoiceInfo> children;

	public ChargeInvoiceInfo(){}

	public ChargeInvoiceInfo(ChargeBillsJump bill){
		this.invoiceDm=bill.getInvoiceGrnno();
		this.invoiceHm=bill.getInvoiceNo();
		this.invoiceObject=bill.getFeeitemName();
		this.num=bill.getNum();
		this.unit=bill.getUnit();
		this.unitPrice=bill.getFeePrice();
		this.money=bill.getZjJe();
		this.abstractInfo=bill.getZjCny();
		this.subjectCode=bill.getSubjectsCode();
		this.invoiceId=bill.getInvoiceId();
		this.feeitemId=bill.getFeeitemId();
		this.isDay=bill.getIsDay();
		this.tax=bill.getTaxPaid();
		this.rate=bill.getTaxRate();
		this.realMoney=bill.getUnitPrice();
		this.realPrice=bill.getIncome();
		this.createBy=bill.getCreateBy();
		this.createDate=bill.getCreateDate();
		this.updateBy=bill.getUpdateBy();
		this.updateDate=bill.getUpdateDate();
	}

	public String getPayMethodStr() {
		return PayTypeEnum.getDesc(this.payMethod);
	}
}
